package com.itheima.order.service;

import com.itheima.order.dao.OrderMapper;
import com.itheima.order.pojo.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;
@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;
    public List<Order> findAll() {
        return orderMapper.selectAll() ;
    }

    public List<Order> findOrderByName(String username) {
        Example example = new Example(Order.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("username",username);
        List<Order> orderList = orderMapper.selectByExample(example);
        return orderList;
    }
}
